% TEST_ID: LANG-EXPAND-0109
% CATEGORY: language/string
% 测试 string 的插入

function test_string_insertAfter()
str = "The quick fox jumps";
newStr = insertAfter(str,"quick"," brown");
assert(newStr == ("The quick brown fox jumps"));
assert(str == "The quick fox jumps")

str = ["The quick fox jumps";"over the dog"];
newStr = insertAfter(str,["quick";"the"],[" brown";" lazy"]);
result = ["The quick brown fox jumps";"over the lazy dog"];
assert(newStr == result);

str = "James Maxwell";
newStr = insertAfter(str,5," Clerk");
result = ["James Clerk Maxwell"];
assert(newStr == result);

str = ["James Maxwell";"Carl Gauss"];
newStr = insertAfter(str,[5;4],[" Clerk";" Friedrich"]);
result = ["James Clerk Maxwell"; "Carl Friedrich Gauss"];
assert(newStr == result);

chr = 'mushrooms and onions';
newChr = insertAfter(chr,9,', peppers,');
result = ["mushrooms, peppers, and onions"];
assert(newChr == result);

chr = 'mushrooms and onions';
newChr = insertAfter(chr,'mushrooms',', peppers,')
result = ["mushrooms, peppers, and onions"]
assert(newChr == result);

end
